<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script type="text/javascript" src="../assets/js/vue.js"></script>
    <title>Vue.extend扩展实例构造器</title>
</head>
<body>
    <h1>Vue.extend扩展实例构造器</h1>
    <hr>
    <div id="author"></div>
    <author></author>
    <script type="text/javascript">
        var authorExtend = Vue.extend({
            //模板
            template:"<p><a :href='authorUrl'>{{authorName}}</a></p>",
            //数据这么写
            data:function(){
                return{
                    authorName:"百度",
                    authorUrl:"http://www.baidu.com"
                }
            }
        });
        //生成构造器并绑定标签
       var authorExtendInstance1 =  new authorExtend();
       var authorExtendInstance2 =  new authorExtend();
       //（绑定标签跟选择器相同）
       //标签绑定法
       authorExtendInstance1.$mount("author");
        //id绑定法
        authorExtendInstance2.$mount("#author");


    </script>
    
</body>
</html>